# == Defined type: ceph::rbd
#
#
define ceph::rbd (
  $id,
  $keyring
) {
  ensure_resource('service', 'rbdmap', { 'ensure' => 'running', 'enable' => 'true' })

  file_line { "${title}_rbdmap":
    line   => "${title} id=${id},keyring=${keyring}",
    path   => '/etc/ceph/rbdmap',
    notify => Service['rbdmap'],
  }

  exec { "ensure ${title} is mapped":
    command => '/bin/true',
    unless  => "/bin/test -b /dev/rbd/${title}",
    notify  => Service['rbdmap'],
  }
}

